package com.gxa.modules.service.operationsservice.impl;

import com.gxa.common.R;
import com.gxa.modules.mapper.operationsmapper.LtyZuHuRenYuanMapper;
import com.gxa.modules.service.operationsservice.LtyZuHuRenYuanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Company
 * @Classname LtyZuHuRenYuanServiceImpl
 * @Description TODO
 * @Author lty
 * Date 2022/5/10 0010 10:01
 * Version 1.0
 */

@Service
public class LtyZuHuRenYuanServiceImpl implements LtyZuHuRenYuanService {

    R r = new R();

    @Autowired(required = false)
    LtyZuHuRenYuanMapper ltyZuHuRenYuanMapper;



    @Override
    public R selectLouYuXiaLa() {
        r.setMsg("查询成功");
        r.setData(ltyZuHuRenYuanMapper.selectLouYuXiaLa());
        r.setCode(200);
        return r;
    }


    @Override
    public R selectRenYuanLeiXinXiaLa() {
        r.setMsg("查询成功");
        r.setData(ltyZuHuRenYuanMapper.selectRenYuanLeiXinXiaLa());
        r.setCode(200);
        return r;
    }


    @Override
    public R selectAllZuHuRenYuan(int page ,int size) {
        r.setMsg("查询成功");
        int count = (page -1) * size;
        r.setData(ltyZuHuRenYuanMapper.selectAllZuHuRenYuan(count ,size));
        r.setCount(ltyZuHuRenYuanMapper.selectAllZuHuRenYuanCount());
        r.setCode(200);
        return r;
    }


    @Override
    public R selectZuHuRenYuan(int page, int size,
                               String zuHuMingCheng, String louYu, String fangJian,
                               String renYuan, String lianXiFangShi, String renYuanLeiXing) {
        r.setMsg("查询成功");
        int count = (page -1) * size;
        r.setData(ltyZuHuRenYuanMapper.selectZuHuRenYuan(count,size,
                zuHuMingCheng,louYu,fangJian,renYuan,lianXiFangShi,renYuanLeiXing));
        r.setCount(ltyZuHuRenYuanMapper.selectZuHuRenYuanCount(zuHuMingCheng,louYu,fangJian,renYuan
                ,lianXiFangShi,renYuanLeiXing));
        r.setCode(200);
        return r;
    }
}
